package com.hctforgreen.greenservice.model;

import java.util.List;

import org.json.JSONObject;

/**
 * 考试试题
 * 
 * @author denghb
 * 
 */
public class ExamSubEntity extends BaseEntity {
	/**
	 * 
	 */
	private static final long serialVersionUID = 0x1922L;
	public String id = "";// "5a4f44d7-0dc5-11e5-bbe6-2c27d7419219",
	public String createTime;
	public String analyze = "";// 答案解析
	public Integer point;// 分数
	public String remark = "";// 备注
	public String name = "";// 题目
	public String answer = "";// 正确答案
	public String type;// 题目类型： 1 表示单选题，2表示多选题，3表示判断题，4表示排序题

	public String option = "";// 答案选项 用';'隔开

	public String inputAnswer = "";

	public String wrongAnswer = "";

	public List<String> offerAnswerList;

	public List<String> rightAnswerList;

	public List<String> inputAnswerList;

	public List<String> wrongAnswerList;

	public List<String> pictureAnswerList;
	/**
	 * 全对、半对、全错、""为未做
	 */
	public String inputAnswerResult = "";
	/**
	 * 得分
	 */
	public double inputAnswerScore = 0;

	public String paperId = "";// 试卷id

	/**
	 * 2017-1-10
	 * 新增图片字段 地址
	 */
	public String pic_a = "";// 图片A
	public String pic_b = "";// 图片B
	public String pic_c = "";// 图片C
	public String pic_d = "";// 图片D

	/**
	 * json解析
	 * 
	 * @param jsonObject
	 * @return ExamSubEntity entity考试试题
	 * @throws Exception
	 */
	public static ExamSubEntity parse(JSONObject jsonObject) throws Exception {
		ExamSubEntity entity = new ExamSubEntity();
		if (jsonObject == null) {
			return entity;
		}
		if (jsonObject.has("id")) {
			entity.id = jsonObject.getString("id");
		}

		if (jsonObject.has("analytical")) {
			entity.analyze = jsonObject.getString("analytical");
		}
		if (jsonObject.has("correctAnswer")) {
			entity.answer = jsonObject.getString("correctAnswer");
		}
		if (jsonObject.has("createTime")) {
			entity.createTime = jsonObject.getString("createTime");
		}
		if (jsonObject.has("name")) {
			entity.name = jsonObject.getString("name");
		}
		if (jsonObject.has("optionAnswer")) {
			entity.option = jsonObject.getString("optionAnswer").replace(" ",
					"");
		}
		if (jsonObject.has("point")) {
			entity.point = jsonObject.getInt("point");
		}
		if (jsonObject.has("remark")) {
			entity.remark = jsonObject.getString("remark");
		}
		if (jsonObject.has("type")) {
			entity.type = jsonObject.getString("type");
		}
		if (jsonObject.has("pic_a")) {
			entity.pic_a = jsonObject.getString("pic_a");
		}
		if (jsonObject.has("pic_b")) {
			entity.pic_b = jsonObject.getString("pic_b");
		}
		if (jsonObject.has("pic_c")) {
			entity.pic_c = jsonObject.getString("pic_c");
		}
		if (jsonObject.has("pic_d")) {
			entity.pic_d = jsonObject.getString("pic_d");
		}
		return entity;
	}
}